package com.yuanfengerp.Analysis.controller;

import com.alibaba.fastjson.JSON;
import com.yuanfengerp.Analysis.model.RolePipe;
import com.yuanfengerp.Analysis.service.IRolePipeService;
import com.yuanfengerp.publicUtil.Result;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;

@CrossOrigin
@RestController
public class RolePipeController {
    @Autowired
    private IRolePipeService irps;

    /**
     *  新增角色
     * @param rolePipe
     * @return
     */
    @PostMapping("/insertRolePipe")
    public Result<RolePipe> addRolePipe(@RequestBody RolePipe rolePipe){
        return irps.addRolePipe(rolePipe);
    }

    /**
     *  查询角色
     * @param role_serial
     * @param role_name
     * @return
     */
    @PostMapping("/getRolePipe")
    public Result<RolePipe> getRolePipe(String role_serial,String role_name){
        return irps.getRolePipe(role_serial,role_name);
    }
    @PostMapping("/getRolePipeList")
    public ArrayList<RolePipe> getRolePipeList(@RequestParam("pageSize") Integer pageSize, @RequestParam("offset") Integer offset){
        return irps.getRolePipeList(pageSize,offset);
    }
    @PostMapping("/updateRolePipe")
    public Result<RolePipe> updateRolePipe(@RequestBody RolePipe rolePipe){
        System.out.println(rolePipe.toString());
        return irps.updateRolePipe(rolePipe);
    }
}
